package com.ruoyi.management.basics.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.ruoyi.management.basics.mapper.TCarMapper;
import com.ruoyi.management.basics.ro.GetVehiclesInformationListParam;
import com.ruoyi.management.basics.service.ITCarService;
import com.ruoyi.management.basics.vo.GetBannerListVo;
import com.ruoyi.management.basics.vo.GetCarNoCompanyIdVo;
import com.ruoyi.management.basics.vo.GetOperateNumVo;
import com.ruoyi.management.basics.vo.GetVehiclesInformationListVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-30
 */
@Service
public class TCarServiceImpl implements ITCarService {
    @Resource
    private TCarMapper tCarMapper;

    @Override
    public List<GetOperateNumVo> getOperateNum() {
        return tCarMapper.getOperateNum();
    }

    @Override
    public Integer getCompanyIdByCarNo(String carNo) {
        return tCarMapper.getCompanyIdByCarNo(carNo);
    }

    @Override
    public List<GetCarNoCompanyIdVo> getCarNoCompanyId() {
        return tCarMapper.getCarNoCompanyId();
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<GetVehiclesInformationListVo> getVehiclesInformation(GetVehiclesInformationListParam param) {
        List< GetVehiclesInformationListVo > voList = tCarMapper.getVehiclesInformation(param);
        if (CollUtil.isEmpty(voList)) {
            return new ArrayList<>();
        }
        return  voList;
    }

}
